package dataS.stack;

public class MyStack {
    //栈的底层也是数组
    private int []array=null;
    int top;


    public MyStack() {
        array=new int[10];
        top=-1;
    }
    public MyStack(int size){
        array=new int[size];
        top=-1;
    }
    public void push(int value){
        array[++top]=value;
    }
    public int pop(){
        return array[top--];
    }
    public boolean empty(){
        if(top==-1)
            return true;
        return false;
    }
    //查看栈顶元素
    public int peek(){
        return array[top];
    }
    public boolean isFull(){
        if(top==(array.length-1))
            return true;
        return false;
    }





}
